{
  "sources": {
    "cluster_logging_config/test-file": {
      "type": "file",
      "include": [
        "/var/log/kube-audit/audit.log"
      ]
    },
    "cluster_logging_config/test-kubernetes": {
      "type": "kubernetes_logs",
      "extra_label_selector": "log-shipper.deckhouse.io/exclude notin (true)",
      "extra_field_selector": "metadata.name!=$VECTOR_SELF_POD_NAME",
      "extra_namespace_label_selector": "log-shipper.deckhouse.io/exclude notin (true)",
      "annotation_fields": {
        "container_image": "image",
        "container_name": "container",
        "pod_ip": "pod_ip",
        "pod_labels": "pod_labels",
        "pod_name": "pod",
        "pod_namespace": "namespace",
        "pod_node_name": "node",
        "pod_owner": "pod_owner"
      },
      "node_annotation_fields": {
        "node_labels": "node_labels"
      },
      "glob_minimum_cooldown_ms": 1000,
      "use_apiserver_cache": true
    }
  },
  "transforms": {
    "transform/destination/test-vector-dest/00_del_parsed_data": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-file/01_local_timezone",
        "transform/source/test-kubernetes/02_local_timezone"
      ],
      "source": "if exists(.parsed_data) {\n    del(.parsed_data)\n}",
      "type": "remap"
    },
    "transform/source/test-file/00_clean_up": {
      "drop_on_abort": false,
      "inputs": [
        "cluster_logging_config/test-file"
      ],
      "source": "if exists(.pod_labels.\"controller-revision-hash\") {\n    del(.pod_labels.\"controller-revision-hash\")\n}\nif exists(.pod_labels.\"pod-template-hash\") {\n    del(.pod_labels.\"pod-template-hash\")\n}\nif exists(.kubernetes) {\n    del(.kubernetes)\n}\nif exists(.file) {\n    del(.file)\n}\nif exists(.node_labels.\"node.deckhouse.io/group\") {\n\t.node_group = (.node_labels.\"node.deckhouse.io/group\")\n}\ndel(.node_labels)",
      "type": "remap"
    },
    "transform/source/test-file/01_local_timezone": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-file/00_clean_up"
      ],
      "source": "if exists(.\"timestamp\") {\n    ts = parse_timestamp!(.\"timestamp\", format: \"%+\")\n    .\"timestamp\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}\n\nif exists(.\"timestamp_end\") {\n    ts = parse_timestamp!(.\"timestamp_end\", format: \"%+\")\n    .\"timestamp_end\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}",
      "type": "remap"
    },
    "transform/source/test-kubernetes/00_owner_ref": {
      "drop_on_abort": false,
      "inputs": [
        "cluster_logging_config/test-kubernetes"
      ],
      "source": "if exists(.pod_owner) {\n    .pod_owner = string!(.pod_owner)\n\n    if starts_with(.pod_owner, \"ReplicaSet/\") {\n        hash = \"-\"\n        if exists(.pod_labels.\"pod-template-hash\") {\n            hash = hash + string!(.pod_labels.\"pod-template-hash\")\n        }\n\n        if hash != \"-\" \u0026\u0026 ends_with(.pod_owner, hash) {\n            .pod_owner = replace(.pod_owner, \"ReplicaSet/\", \"Deployment/\")\n            .pod_owner = replace(.pod_owner, hash, \"\")\n        }\n    }\n\n    if starts_with(.pod_owner, \"Job/\") {\n        if match(.pod_owner, r'-[0-9]{8,11}$') {\n            .pod_owner = replace(.pod_owner, \"Job/\", \"CronJob/\")\n            .pod_owner = replace(.pod_owner, r'-[0-9]{8,11}$', \"\")\n        }\n    }\n}",
      "type": "remap"
    },
    "transform/source/test-kubernetes/01_clean_up": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-kubernetes/00_owner_ref"
      ],
      "source": "if exists(.pod_labels.\"controller-revision-hash\") {\n    del(.pod_labels.\"controller-revision-hash\")\n}\nif exists(.pod_labels.\"pod-template-hash\") {\n    del(.pod_labels.\"pod-template-hash\")\n}\nif exists(.kubernetes) {\n    del(.kubernetes)\n}\nif exists(.file) {\n    del(.file)\n}\nif exists(.node_labels.\"node.deckhouse.io/group\") {\n\t.node_group = (.node_labels.\"node.deckhouse.io/group\")\n}\ndel(.node_labels)",
      "type": "remap"
    },
    "transform/source/test-kubernetes/02_local_timezone": {
      "drop_on_abort": false,
      "inputs": [
        "transform/source/test-kubernetes/01_clean_up"
      ],
      "source": "if exists(.\"timestamp\") {\n    ts = parse_timestamp!(.\"timestamp\", format: \"%+\")\n    .\"timestamp\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}\n\nif exists(.\"timestamp_end\") {\n    ts = parse_timestamp!(.\"timestamp_end\", format: \"%+\")\n    .\"timestamp_end\" = format_timestamp!(ts, format: \"%+\", timezone: \"local\")\n}",
      "type": "remap"
    }
  },
  "sinks": {
    "destination/cluster/test-vector-dest": {
      "type": "vector",
      "inputs": [
        "transform/destination/test-vector-dest/00_del_parsed_data"
      ],
      "healthcheck": {
        "enabled": false
      },
      "version": "2",
      "address": "192.168.1.1:9200",
      "tls": {
        "verify_certificate": false,
        "verify_hostname": false
      }
    }
  }
}
